import axios from 'axios';
import { ElMessageBox } from 'element-plus';

let _base = import.meta.env.VITE_Hardware || "";

export async function openCamera(params?: object) {
	axios.post(_base + "/api/capture", params);
	return new Promise(function(resolve){
		ElMessageBox.alert('我们正在打开拍照程序，如果您已经完成拍照，请点击刷新', '提示', {
			confirmButtonText: '刷新',
			callback:resolve
		});
	});
}
//人像拍照
export async function openCameraForPhoto(params?: object) {
	axios.post(_base + '/api/captureFace', params);
	return new Promise(function(resolve){
		ElMessageBox.alert('我们正在打开拍照程序，如果您已经完成拍照，请点击刷新', '提示', {
			confirmButtonText: '刷新',
			callback:resolve
		});
	});
}

export async function openSign(params?: object) {
	axios.post(_base + '/api/sign', params);
}

//开柜存物
export async function openHardBox(params?: object) {
	axios.post(_base + '/api/cabinet', params);
}

export async function rfidPrint(params?: object) {
  return	axios.post(_base + '/api/print', params);
}

export async function writeRfid(params?: object) {
  return axios.post(_base + '/api/writeepc', params);
}
